import moment from 'moment';

export default class SequenceUtils {
  constructor(options) {
    this.options = options;
  }

  getline_xAxis(index) {
    const _x_offset = -8; // TODO：我也不知道为什么会偏移8px
    const {
      Y_LINE_SPACING,
      X_OFFSET,
      X_BOX_WIDTH,
      X_BOX_SPACING,
      X_BOX_HIGH,
    } = this.options.LAYOUT;
    const initOffset = _x_offset + X_OFFSET + X_BOX_WIDTH / 2;
    return initOffset + index * (X_BOX_WIDTH + X_BOX_SPACING);
  }

  formatTimestamps(time) {
    return moment(`${time}00000`.substr(0, 14), 'YYYYMMDDHHmmss').format(
      'YYYY/MM/DD HH:mm:ss',
    );
  }
}

